import { Swiper } from 'antd-mobile';
import React, { Component } from 'react';
import { swiper_list } from "../../../api/index";
import '../../../styles/index/home/Switer.scss'

class Switer extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  async componentDidMount() {
    var res = await swiper_list()
    // console.log(res.data);
    this.setState({ list: res.data })
  }

  render() {
    return (
      <div className='switer1'>
        <Swiper autoplay loop>
          {
            this.state.list.map((item, index) => {
              return (
                <Swiper.Item key={index}>
                  <div>
                    <img src={item.pic} alt="" />
                  </div>
                </Swiper.Item>
              )
            })

          }
        </Swiper>
      </div>
    );
  }
}

export default Switer;